﻿@model EnterpriseFund.Model.DM_YSKM
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
@Html.Partial("LoadPanelPartial")
<head>
    <title></title>
    @if (false)
    {
        <script src="../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
    }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />

    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>

    @Html.DevExpress().GetStyleSheets(

        new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme }
)
    @Html.DevExpress().GetScripts(
        new Script { ExtensionType = ExtensionType.ListBox }
)


    <script type="text/javascript">
        function OK() {

            lpModal.Show();
            var fYSKM_DM = tbYSKM_DM.GetText();
            var fZSXM_DM = tbZSXM_DM.GetValue();
            var fYSKM_MC = tbYSKM_MC.GetText();
            var fYSK_DM = tbYSK_DM.GetText();
            var fYSK_MC = tbYSK_MC.GetText();
            var fGS_YSKM_MC = tbGS_YSKM_MC.GetText();

            if (pd(fYSKM_DM, fYSKM_MC, fZSXM_DM)) {
                fYSKM_DM = ASPxClientUtils.Trim(fYSKM_DM);
                fYSKM_MC = ASPxClientUtils.Trim(fYSKM_MC);
                fYSK_DM = ASPxClientUtils.Trim(fYSK_DM);
                fYSK_MC = ASPxClientUtils.Trim(fYSK_MC);
                fGS_YSKM_MC = ASPxClientUtils.Trim(fGS_YSKM_MC);

                $.ajax({
                    type: 'POST',
                    url: rootPath + '/YSKMManager/YSKMSave',
                    data: { YSKM_DM: fYSKM_DM, ZSXM_DM: fZSXM_DM, YSKM_MC: fYSKM_MC, YSK_DM: fYSK_DM, YSK_MC: fYSK_MC, GS_YSKM_MC: fGS_YSKM_MC, isAdd: '@ViewData["blcodeNo"]' },
                    success: function (result) {
                        lpModal.Hide();
                        if (result == "exists") {
                            tbCodeNo.SetErrorText("编码已存在");
                            tbCodeNo.SetIsValid(false);
                        } else if (result == "ok") {
                            parent.codeOK();
                        } else if (result == "error") {
                            alert("保存失败");
                        }
                    }
                });

            } else {
                lpModal.Hide();
            }

        }


        function pd(codeNo, codeName, taxNo) {
            var bl = true;
            if (null == codeNo || ASPxClientUtils.Trim(codeNo) == "") {
                tbZSXM_DM.SetErrorText("请填写预算科目代码");
                tbZSXM_DM.SetIsValid(false);
                bl = false;
            }
            if (null == codeName || ASPxClientUtils.Trim(codeName) == "") {
                tbYSKM_DM.SetErrorText("请填写预算科目名称");
                tbYSKM_DM.SetIsValid(false);
                bl = false;
            }
            if (null == taxNo || ASPxClientUtils.Trim(taxNo) == "") {
                tbCodeName.SetErrorText("税种必须选择");
                tbCodeName.SetIsValid(false);
                bl = false;
            }

            return bl;
        }

    </script>

</head>
<body>
    <table class="tableFrom">
        <tr>
            <th style=" width:150">
               税种选择:</th>
            <td>
               @Html.DevExpress().ComboBox(settings =>
               {
                   settings.Name = "tbZSXM_DM";
                   if ((bool)@ViewData["blcodeNo"])
                   {
                       settings.ReadOnly = false;
                   }
                   else
                   {
                       settings.ReadOnly = true;
                   }
                   settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
                   settings.Width = 150;
                   settings.Properties.TextField = "FTaxClassName";
                   settings.Properties.ValueField = "FTaxClassNo";
               }).BindList(ViewData["TaxClassList"]).Bind(Model.ZSXM_DM).GetHtml()
               
            </td>
        </tr>
        <tr>
            <th style=" width:150">
               预算科目代码:</th>
            <td>
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "tbYSKM_DM";
                   settings.Width = 150;
                   if ((bool)@ViewData["blcodeNo"])
                   {
                       settings.ReadOnly = false;
                   }
                   else
                   {
                         settings.ReadOnly = true;
                   }
                   settings.Text = Model.YSKM_DM;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
            </td>
        </tr>
           
        <tr>
            <th style=" width:150">
                预算科目名称:</th>
            <td>
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "tbYSKM_MC";
                   settings.Width = 150;
                   settings.Text = Model.YSKM_MC;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
            </td>
        </tr>
        <tr>
            <th style=" width:150">
              预算款代码:</th>
            <td>
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "tbYSK_DM";
                   settings.Width = 150;
                   settings.Text = Model.YSK_DM;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
            </td>
        </tr>
         <tr>
            <th style=" width:150">
              预算款名称:</th>
            <td>
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "tbYSK_MC";
                   settings.Width = 150;
                   settings.Text = Model.YSK_MC;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
            </td>
        </tr>
        <tr>
            <th style=" width:150">
              国税预算科目名称:</th>
            <td>
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "tbGS_YSKM_MC";
                   settings.Width = 150;
                   settings.Text = Model.GS_YSKM_MC;
                   settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
            </td>
        </tr>
    </table>

    <script>
        lp.Hide();
    </script>

</body>
</html>
